import {computed, ref} from "vue";
import {defineStore} from "pinia";
export const progressStore = defineStore("progress",()=>{
  const progress = ref(0)
  const totalSpace = ref(0)
  const useSpace = ref(0)

  const setTotalSpace = (value) => {
    totalSpace.value = value
  }

  const setUseSpace = (value) => {
    useSpace.value = value
  }

  const getProgress = () => {
    computed(()=>{
      return (useSpace.value / totalSpace.value).toFixed(2)
    })
  }

  return {progress,totalSpace,useSpace,setTotalSpace,setUseSpace,getProgress}
})